package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConTouristProblemUpload;
import com.htgd.gardenexpo.dao.GeConTouristProblemUploadDao;
import com.htgd.gardenexpo.service.GeConTouristProblemUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConTouristProblemUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 14:40:59
 */
@Service("geConTouristProblemUploadService")
public class GeConTouristProblemUploadServiceImpl implements GeConTouristProblemUploadService {
    @Resource
    private GeConTouristProblemUploadDao geConTouristProblemUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemUpload queryById(Integer id) {
        return this.geConTouristProblemUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConTouristProblemUpload> queryAllByLimit(int offset, int limit) {
        return this.geConTouristProblemUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConTouristProblemUpload> queryByProblemId(int id) {
        return this.geConTouristProblemUploadDao.queryByProblemId(id);
    }

    /**
     * 新增数据
     *
     * @param geConTouristProblemUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemUpload insert(GeConTouristProblemUpload geConTouristProblemUpload) {
        this.geConTouristProblemUploadDao.insert(geConTouristProblemUpload);
        return geConTouristProblemUpload;
    }

    /**
     * 修改数据
     *
     * @param geConTouristProblemUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConTouristProblemUpload update(GeConTouristProblemUpload geConTouristProblemUpload) {
        this.geConTouristProblemUploadDao.update(geConTouristProblemUpload);
        return this.queryById(geConTouristProblemUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConTouristProblemUploadDao.deleteById(id) > 0;
    }
    @Override
    public boolean deleteByProblemId(Integer id) {
        return this.geConTouristProblemUploadDao.deleteByProblemId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int pid) {
        return this.geConTouristProblemUploadDao.deleteByIds(id,pid) > 0;
    }
}
